import request from '@/utils/request'
import {baseUrlConfig,baseUrl} from "@/config/config";

const basePath = baseUrlConfig.businessBaseUrl;
const userPath = baseUrlConfig.userCenterUrl;
//获取分页列表
export const cataloguePageList: () => Promise<[]> = () => {
  return request({
    url: baseUrl + '/exterUnitCatalog/findAll2',
    method: 'get',
  })
}

//新增类别
export const addCatalogue: (data: any) => Promise<[]> = (data) => {
  return request({
    url:  baseUrl + '/exterUnitCatalog/add',
    method: 'post',
    data
  })
}
//编辑类别
export const editCatalogue: (data: any) => Promise<[]> = (data) => {
  return request({
    url: baseUrl + '/exterUnitCatalog/put',
    method: 'put',
    data
  })
}
// 删除
export const deleteCatalogue: (data: any) => Promise<[]> = (data) => {
  return request({
    url:  baseUrl + '/exterUnitCatalog/del',
    method: 'delete',
    data
  })
}
// 获取用户信息
export const getUserInfo = async (data:any) => {
  return request({
    url: userPath + '/user/get?id='+data,
    method: 'get'
  })
}

//获取一级类别和id
export const listIdAndType = () => {
  return request({
    url: basePath + '/secure/catalogue/listIdAndType',
    method: 'get'
  })
}
